package com.ruoyi.project.exam.domain;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.constant.ExamStateConstants;
import com.ruoyi.framework.web.domain.BaseEntity;


/**
 * 考试管理
 * 
 * @author Administrator
 *
 */
public class ExamModel extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/**
	 * ID
	 */
	private String id;

	/**
	 * 考试名称
	 */
	private String title;

	/**
	 * 考试描述
	 */
	private String content;

	/**
	 * 1公开2部门3定员
	 */
	private Integer openType;

	/**
	 * 组题方式1题库,2指定
	 */
	private Integer joinType;

	/**
	 * 难度:0不限,1普通,2较难
	 */
	private Integer level;

	/**
	 * 考试状态
	 */
	private Integer state;

	/**
	 * 是否限时
	 */
	private Boolean timeLimit;

	/**
	 * 开始时间
	 */
	private Date startTime;

	/**
	 * 结束时间
	 */
	private Date endTime;

	/**
	 * 总分数
	 */
	private Integer totalScore;

	/**
	 * 总时长（分钟）
	 */
	private Integer totalTime;

	/**
	 * 及格分数
	 */
	private Integer qualifyScore;

	/** 最大考试次数 */
	private Integer maxCount;

	/**
	 * 删除标志 0：存在 1：删除
	 */
	private String delFlag;

	/** 发布状态 */
	private Integer rlsState;
	/**题库规则JSON字符串*/
	private String examRepo;
	/**
	 * 组装试卷数
	 */
	private Integer paperNum;
	
	private List<ExamRepoModel> examRepoList;
	
	/**
	 * 用户ID
	 */
	private Long userId;
	
	/**
	 * 考试次数
	 */
	private Integer tryCount;
	
	/**
	 * 是否通过
	 */
	private boolean passed;
 

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Integer getOpenType() {
		return openType;
	}

	public void setOpenType(Integer openType) {
		this.openType = openType;
	}

	public Integer getJoinType() {
		return joinType;
	}

	public void setJoinType(Integer joinType) {
		this.joinType = joinType;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getState() {
		if (this.timeLimit != null && this.timeLimit) {
			if (System.currentTimeMillis() < startTime.getTime()) {
				return ExamStateConstants.READY_START;
			}

			if (System.currentTimeMillis() > endTime.getTime()) {
				return ExamStateConstants.OVERDUE;
			}

			if (System.currentTimeMillis() > startTime.getTime() 
					&& System.currentTimeMillis() < endTime.getTime()
					&& !ExamStateConstants.DISABLED.equals(this.state)) {
				return ExamStateConstants.ENABLE;
			}
		}
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public Boolean getTimeLimit() {
		return timeLimit;
	}

	public void setTimeLimit(Boolean timeLimit) {
		this.timeLimit = timeLimit;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Integer getTotalScore() {
		return totalScore;
	}

	public void setTotalScore(Integer totalScore) {
		this.totalScore = totalScore;
	}

	public Integer getTotalTime() {
		return totalTime;
	}

	public void setTotalTime(Integer totalTime) {
		this.totalTime = totalTime;
	}

	public Integer getQualifyScore() {
		return qualifyScore;
	}

	public void setQualifyScore(Integer qualifyScore) {
		this.qualifyScore = qualifyScore;
	}

	public Integer getMaxCount() {
		return maxCount;
	}

	public void setMaxCount(Integer maxCount) {
		this.maxCount = maxCount;
	}

	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public Integer getRlsState() {
		return rlsState;
	}

	public void setRlsState(Integer rlsState) {
		this.rlsState = rlsState;
	}

	public String getExamRepo() {
		return examRepo;
	}

	public void setExamRepo(String examRepo) {
		this.examRepo = examRepo;
	}

	public Integer getPaperNum() {
		return paperNum;
	}

	public void setPaperNum(Integer paperNum) {
		this.paperNum = paperNum;
	}

	public List<ExamRepoModel> getExamRepoList() {
		return examRepoList;
	}

	public void setExamRepoList(List<ExamRepoModel> examRepoList) {
		this.examRepoList = examRepoList;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Integer getTryCount() {
		return tryCount;
	}

	public void setTryCount(Integer tryCount) {
		this.tryCount = tryCount;
	}

	public boolean isPassed() {
		return passed;
	}

	public void setPassed(boolean passed) {
		this.passed = passed;
	}

	

	
}
